package pailaidai.hc.com.mysvgdemo.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import pailaidai.hc.com.mysvgdemo.R;
import pailaidai.hc.com.mysvgdemo.view.RoundStrokeView;

public class OpenBook extends AppCompatActivity implements View.OnClickListener{
    private Button openBook;
    private RoundStrokeView open_round;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_open_book);
        initView();
    }

    private void initView() {
        openBook= (Button) findViewById(R.id.openBook);
        open_round= (RoundStrokeView) findViewById(R.id.open_round);

        openBook.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.openBook:
                animate();




//                view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);//隐藏虚拟的返回键

//            int curremVis=view.getSystemUiVisibility();//设置状态栏里的隐藏显示
//              int newVis;
//                if((curremVis&View.SYSTEM_UI_FLAG_LOW_PROFILE)==View.SYSTEM_UI_FLAG_LOW_PROFILE){
//                 newVis=View.SYSTEM_UI_FLAG_VISIBLE;
//                }else {
//                    newVis=View.SYSTEM_UI_FLAG_LOW_PROFILE;
//                }
//               view.setSystemUiVisibility(newVis);
                break;

        }

    }
      /*动画*/
    private void animate() {
        if(open_round.getAlpha()>0f){
            //如果视图已经可见，将其从右侧滑出
            open_round.animate().alpha(0f).translationX(1000f);
        }else {
            //如果视图是隐藏的，原地做渐显动画
            open_round.setTranslationX(0f);
            open_round.animate().alpha(1f);
        }


    }
}
